<template>
  <div>
    <!-- 资产详情 -->
    <AssetDescriptions
      v-if="form.id != null"
      class="mt10"
      :id="form.id"
    ></AssetDescriptions>

    <!-- 采购计划详情 -->
    <PurchaseDescriptions
      v-if="form.purchaseId != null"
      class="mt20"
      :id="form.purchaseId"
    ></PurchaseDescriptions>

    <!-- 资产使用详情 -->
    <UseDescriptions
      v-if="form.assetState == '使用中'"
      class="mt20"
      :id="form.id"
    ></UseDescriptions>
    
    <!-- 资产维修详情 -->
    <RepairDescriptions
      v-if="form.assetState == '维修中'"
      class="mt20"
      :id="form.id"
    ></RepairDescriptions>
  </div>
</template>

<script>
import { get } from "@/api/prod/asset/account";
import AssetDescriptions from "@/views/prod/asset/account/descriptions";
import PurchaseDescriptions from "@/views/prod/purchase/plan/descriptions";
import UseDescriptions from "@/views/prod/use/use/descriptions";
import RepairDescriptions from "@/views/prod/repair/repair/descriptions";

export default {
  name: "Detail",
  components: {
    AssetDescriptions,
    PurchaseDescriptions,
    UseDescriptions,
    RepairDescriptions,
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 基础信息
      form: {},
    };
  },

  created() {
    this.getDetail();
  },

  methods: {
    /** 表单重置 */
    reset() {},

    /** 查询资产详细 */
    getDetail() {
      this.loading = true;
      get(this.$route.query.id).then((response) => {
        this.form = response.data;
        this.loading = false;
      });
    },
  },
};
</script>

<style>
</style>